home *** CD-ROM | disk | FTP | other *** search
- Path: ponder.csci.unt.edu!birdi
- From: birdi@ponder.csci.unt.edu (Arvinder S. Birdi )
- Newsgroups: comp.lang.c++
- Subject: too many field types in classes
- Date: 25 Mar 1996 21:51:05 GMT
- Organization: University of North Texas, Denton
- Distribution: usa
- Message-ID: <4j74g9$i58@hermes.acs.unt.edu>
- NNTP-Posting-Host: ponder.csci.unt.edu
-
-
- I am writing a db type application with classes that are used mostly
- to store data. (lots of classes simply have fields and set/gets)
-
- Problem:
- there are many field types used in these classes and maintaining
- consistency becomes a problem. (ie was long used to store SSN in class
- x and double is used to store SSN in class y)
-
- solution1:
- typedef the filed types and #include their definitions.
-
- class dbtypes{
- typedef long SSN;
- typedef char[80] name;
- };
-
-
-
- solution2:
- create each type as a tiny class;
-
- class SSN{
- long s;
- }
-
- class Name {
- char[80] n;
- }
-
-
- I'd like comments to the various solutions.
-
- thanks
- -arvinder
-
-
-